<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ch="http://java.sun.com/jsf/composite/channel"
                xmlns:pa="http://java.sun.com/jsf/composite/paymentMethod"
                xmlns:au="http://java.sun.com/jsf/composite/autocomplete">

    <ui:define name="content">
        <h:form id="form">
            <p:panel id="pan1" styleClass="noBorder summeryBorder">
                <f:facet name="header" >
                    <p:outputLabel value="Arrived Doctors" />
                </f:facet>
                <p:panel>
                    <p:poll interval="30"   
                                listener="#{channelReportController.createDoctorArrival()}" update="@all" />
                    <h:panelGrid columns="2" >
                        
                        <p:commandButton value="Process" action="#{channelReportController.createDoctorArrival()}" ajax="false" />
                        <p:commandButton value="Print" action="#" styleClass="noPrintButton">
                            <p:printer target="pan1" />
                        </p:commandButton>
                    </h:panelGrid>
                </p:panel>
                <p:dataTable value="#{channelReportController.arrivalRecords}" var="a" rowIndexVar="i" >
                    <f:facet name="header">
                        <p:outputLabel value="#{sessionController.loggedUser.institution.name}" style="fon"/><br></br>
                        <p:outputLabel value="#{sessionController.loggedUser.institution.address}"/><br></br>
                        <p:outputLabel value="Arrived Doctors"/><br></br>
                        <p:outputLabel value="Date: "/>
                        <p:outputLabel value="#{commonController.currentDateTime}" >
                            <f:convertDateTime pattern="yyyy MMMM dd" />
                        </p:outputLabel>     
                    </f:facet>
                    <p:column style="width: 10px!important;">
                        <f:facet name="header">
                            <p:outputLabel value="No" style="float: left;"/>
                        </f:facet>
                        <p:outputLabel value="#{i+1}" />
                    </p:column>
                    <p:column style="width: 1000px!important;" sortBy="#{a.serviceSession.staff.person.name}">
                        <f:facet name="header">
                            <p:outputLabel value="Consultant" style="float: left;"/>
                        </f:facet>
                        <p:outputLabel value="#{a.serviceSession.staff.person.name}" />
                    </p:column>   
                    <p:column sortBy="#{a.serviceSession.startingTime}">
                        <f:facet name="header">
                            <p:outputLabel value="Session Time" style="float: left;"/>
                        </f:facet>
                        <p:outputLabel value="#{a.serviceSession.startingTime}" >
                            <f:convertDateTime pattern="hh:mm a" />
                        </p:outputLabel>
                    </p:column>   
                    <p:column sortBy="#{a.recordTimeStamp}">
                        <f:facet name="header">
                            <p:outputLabel value="Arrival Time" style="float: left;"/>
                        </f:facet>
                        <p:outputLabel value="#{a.recordTimeStamp}" style="color: darkgreen;font-weight: bold;">
                            <f:convertDateTime pattern="hh:mm:ss a" />
                        </p:outputLabel>
                    </p:column>   
                    <p:column >
                        <f:facet name="header">
                            <p:outputLabel value="Departure Time" style="float: left;"/>
                        </f:facet>
                        <p:outputLabel value="#{a.approvedAt}" style="color: red;font-weight: bold;">
                            <f:convertDateTime pattern="hh:mm:ss a" />
                        </p:outputLabel>
                    </p:column>   
                    
                </p:dataTable>
            </p:panel>
        </h:form>
    </ui:define>



</ui:composition>
